package com.ai.entity.network;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * DS收到SI发送的电文内容
 * @Author jiaok
 * @Date 2023-06-20 10:48
 */
@Data
public class SiToDsSysMessage implements Serializable {

    @ApiModelProperty(value = "电文长度，固定值256")
    private String length;

    @ApiModelProperty(value = "电文号，固定值SIDS01")
    private String teleNo;

    @ApiModelProperty(value = "钢卷号")
    private String coilNo;

    @ApiModelProperty(value = "系统发生故障时发送给打磨系统（状态码内容细化）")
    private String faultState;

    @ApiModelProperty(value = "是否存在缺陷，存在即发送给打磨系统（补充缺陷种类）")
    private String defect;

    @ApiModelProperty(value = "发送跑偏量给打磨系统")
    private String straightDeviation;

    @ApiModelProperty("预留字段")
    private String spare;

    @ApiModelProperty("信号来源")
    private String clientIp;

    @ApiModelProperty("端口")
    private Integer sourcePort;

    @ApiModelProperty("netty客户端code")
    private String nettyCode;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    public boolean equalsByFaultState(Object o) {
        if (o == null){
            return false;
        }
        SiToDsSysMessage that = (SiToDsSysMessage) o;
        return faultState.equals(that.faultState);
    }
    public boolean equalsByDefect(Object o) {
        if (o == null){
            return false;
        }
        SiToDsSysMessage that = (SiToDsSysMessage) o;
        return defect.equals(that.defect) && coilNo.equals(that.coilNo);
    }
    public boolean equalsByStraightDeviation(Object o) {
        if (o == null){
            return false;
        }
        SiToDsSysMessage that = (SiToDsSysMessage) o;
        return straightDeviation.equals(that.straightDeviation) && coilNo.equals(that.coilNo);
    }

}
